export class Grid{
    Width : number = 0;
    Height : number = 0;
    Padding : number;
    constructor(padding :number){
        this.Padding = padding
    }
}

export class Margin {
    Left : number = 0;
    Top : number = 0;
    Width : number = 10;
    Height : number = 20;
    Padding ?:number;
}

function ConsolidateGrid(grid :Grid,margin : Margin): Grid & Margin{
    let consolidateGrid = <Grid & Margin>{...margin}
    consolidateGrid.Left = margin.Left;
    consolidateGrid.Top = margin.Top;
    consolidateGrid.Width = margin.Width + grid.Width;
    consolidateGrid.Height = margin.Height + margin.Height;
    consolidateGrid.Padding = margin.Padding ? margin.Padding : grid.Padding;
    return consolidateGrid;
}


let grid:Grid = <Grid>{
    Height:20,
    Width:10,
    Padding:5
}
let x = ConsolidateGrid(grid,<Margin>{Left:5, Top:5, Width:5, Height:5});
console.log(`Left:${x.Left}, Top:${x.Top},Width:${x.Width},Height:${x.Height},Padding:${x.Padding}`)